import axios from 'axios'

// 创建一个axios实列
const service = axios.create({
  timeout: 3000,
})
// 添加拦截器
service.interceptors.request.use(
  config => {
    // Do something before request is sent
    return config
  },
  error => {
    // Do something with request error
    console.log(error)
  },
)
service.interceptors.response.use(
  response => {
    // Do something before response is sent
    let res = {}
    res.status = response.status
    res.data = response.data
    return res
  },
  error => {
    // Do something with response error
    console.log(error)
  },
)
export default service
